//
//  FriendsDb.h
//  iLo
//
//  Created by Huahang Liu on 10/15/09.
//  Copyright 2009 University of Southern California. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "Friend.h"

enum ParserState {
    E_Locations,
    E_Location,
    E_UserName,
    E_Altitude,
    E_Accuracy,
    E_Coordinate,
    E_Latitude,
    E_Longitude,
    E_Speed,
    E_Direction,
    E_Timestamp,
};

@interface FriendsDb : NSObject {

    NSMutableArray* friends;

    // Used for XML parsing
    ParserState state;
    Friend*         friend_;
    NSMutableArray* friends_;
}

@property (nonatomic, readonly) NSMutableArray* friends;


- (void)refreshFriendsFromURL:(NSURL*)url;

// XML Parsing Methods
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict;
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName;
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;

@end
